import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

class Utils {
  static Widget svgAssets(String asset,
      {String local = 'assets/images',
      Color color,
      double width,
      double height}) {
    return SvgPicture.asset(
      '$local/$asset.svg',
      color: color,
      width: width != null ? width : null,
      height: height != null ? height : null,
    );
  }

  static String getImgPath(String name, {String format: 'png'}) {
    return 'assets/images/$name.$format';
  }

  static void showSnackBar(BuildContext context, String msg) {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text(msg),
        duration: Duration(seconds: 2),
      ),
    );
  }

  /// default pad
  static const double padding = 10;
  static const double radius = 10;
}

/// share_preference key
class SpUtilKey {
  // city page hostory list
  static const String historyList = 'historyList';
  static const String city = 'city';
}

/// 课程卡片类型
enum CourseCardType {
  /// 为你推荐
  recommend,

  /// 专家评估
  professor,

  /// 名师讲座
  teacher,

  /// 家长培训
  parent,

  /// 关联商品
  relate,
}

/// 编辑地址
enum EditAddress { add, edit }

class GMaterialPagePush {
  static materialPagePush(BuildContext context, Widget route) {
    return Navigator.push(
        context, MaterialPageRoute(builder: (context) => route));
  }
}

class StoreDefineCode {
  /// 发现课程banner code
  static const store_course_code = 'Module_FullPic1';

  /// 为你推荐code
  static const store_course_recommend = 'Module_Recommend';

  /// 专家评估code
  static const store_course_assessment = 'Module_Assessment';

  ///名师讲座code
  static const store_course_lecture = 'Module_Lecture';

  ///家长培训code
  static const store_course_training = 'Module_Training';

  /// 适应症
  static const store_course_shift_Status = 'SHIFT_STATUS';

  /// 授课形式
  static const store_course_shift_ = 'SHIFT_TYPE';

  /// 课程班型
  static const store_course_shift_type = 'SHIFT_TYPE';

  /// 科目
  static const store_course_shift_subject = 'SHIFT_SUBJECT';

  /// 热门搜索标签分类id
  static const store_search_category = '5ad904dc-96a1-11eb-9f39-0242ac110002';
}
